package com.lizk.net.nio;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;

public class Client {
	public static void main(String[] args) throws UnknownHostException, IOException, InterruptedException {
		//使用普通的bio发送申请
		
		for(int i  = 0 ; i < 10 ; i ++) {
			new Thread(new Runnable() {
				@Override
				public void run() {
					Socket s = null;
					OutputStream out = null;
					try {
						s = new Socket("127.0.0.1",10001);
						out =  s.getOutputStream();
						out.write("测试一下几IU额得了".getBytes());
						out.write("测试一下几IU额得了".getBytes());
						out.write("测试一下几IU额得了".getBytes());
						out.write("测试一下几IU额得了".getBytes());
						out.flush();
						
					} catch (IOException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}finally {
						try {
							out.close();
						} catch (IOException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
						try {
							s.close();
						} catch (IOException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
					}
					
					
				}
			}).start();
		}
		
		
		Thread.sleep(1000);
		
		
	}
}
